<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      * {
        padding: 0;
        margin: 0;
        box-sizing: border-box;
      }

      body {
        padding: 100px;
        /* display: flex; */
      }

      div {
        display: inline-block;
        width: 50px;
        height: 50px;
        background: green;
      }
    </style>
  </head>
  <body>
    <div></div>
    <button>创建元素</button>
    <script>
      var div = document.querySelector('div')
      var button = document.querySelector('button')
      button.addEventListener('click', function () {
        var div1 = document.createElement('div')
        document.body.appendChild(div1)
      })
    </script>
  </body>
</html>
